package servermain.inter;

import javax.xml.ws.Endpoint;

import org.apache.cxf.interceptor.LoggingInInterceptor;
import org.apache.cxf.interceptor.LoggingOutInterceptor;
import org.apache.cxf.jaxws.EndpointImpl;
import org.springframework.context.support.AbstractApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import com.hysoft.cxf.ws.HelloWorld;


public class ServerMain {
	private static AbstractApplicationContext cxt;

	public static void main(String[] args) {
		cxt = new ClassPathXmlApplicationContext("applicationContext.xml");
		HelloWorld hw = (HelloWorld) cxt.getBean("helloWorldImpl");
		//调用Endpoint的publish发布
		EndpointImpl ep = (EndpointImpl) Endpoint.publish("http://10.71.58.54:9999/hysoft", hw);
		//in拦截器
		ep.getInInterceptors().add(new LoggingInInterceptor());
		//out拦截器
		ep.getOutInterceptors().add(new LoggingOutInterceptor());
		System.out.println("*****暴露成功*****");
	}
}
